// 拼接HTTPUrl
function getUrl(type, pathname) {
  return window.RPConfig[type] + pathname
}

const dataEleApi = {
  // 分页查询所有数据
  getAllData: param => {
    return $http.post(getUrl('itShare', '/customerDataInventory/page'), param).then(res => res.data)
  },
  // 查询list数据
  getListPageData: param => {
    return $http.post(getUrl('itShare', '/customerDataInventory/findList'), param).then(res => res.data)
  },
  // 通过主键查询单条数据
  getDataById: param => {
    return $http.get(getUrl('itShare', '/customerDataInventory/getById'), param).then(res => res.data)
  },
  // 新增数据
  insertData: param => {
    return $http.post(getUrl('itShare', '/customerDataInventory/insert'), param).then(res => res.data)
  },
  // 修改数据
  updateData: param => {
    return $http.post(getUrl('itShare', '/customerDataInventory/update'), param).then(res => res.data)
  },
  // 删除数据
  removeData: param => {
    return $http.post(getUrl('itShare', '/customerDataInventory/delete'), param).then(res => res.data)
  },
  // 汇总数据
  getSummaryData: param => {
    return $http.get(getUrl('itShare', '/customerDataInventory/summary'), param).then(res => res.data)
  },
  // 附件上传
  getDataUploadUrl: () => {
    return getUrl('itShare', '/rptFileRecord/plantask/upload')
  },
  // 附件下载
  downLoadFile: (fileId) => {
    return $http.post(getUrl('itShare', `/rptFileRecord/plantask/download?fileId=${fileId}`)).then(res => res.data)
  },
  // 图片回显
  searchImg: (fileId) => {
    return getUrl('itShare', `/rptFileRecord/plantask/download/get?fileId=${fileId}`)
  }
}

export default dataEleApi